<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button onclick="myFunc()">点击</button>
    <p id="result">你真个小天才呢？</p>
    <script>
        function myFunc() {
            var str1 = "你真个小天才呢？";
            var str2 = str1.replace('天才', '蠢猪');
            document.getElementById('result').innerHTML = str2;
        }
    </script>
</body>

</html>